<template>
  <div class="app">
    <!-- <h2 class="title">测试vue路由</h2> -->
    <Header />
    <!-- 导航区 -->
    <div class="navigate">
      <!-- 路由to的三种写法 -->
      <!-- 1、字符串 -->
      <router-link to="/">首页</router-link>
      <!-- 2、对象-path -->
      <router-link :to="{ path: '/news' }">新闻</router-link>
      <!-- 3、对象-name -->
      <router-link :to="{ name: 'guanyu' }">关于我们</router-link>
    </div>

    <!-- 展示区 -->
    <div class="content">
      <router-view></router-view>
    </div>
  </div>
</template>

<script lang="ts" name="App" setup>
import Header from "./components/Header.vue";
</script>

<style scoped>
/* 基础样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  padding: 2rem;
}

/* .title {
  text-align: center;
  margin-bottom: 2rem;
  color: #2c3e50;
  font-size: 2.5rem;
  font-weight: 300;
  letter-spacing: 1px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
} */

/* 导航栏样式 */
.navigate {
  display: flex;
  justify-content: center;
  margin-bottom: 3rem;
  background: white;
  border-radius: 50px;
  padding: 0.75rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.navigate a {
  position: relative;
  margin: 0 1rem;
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  color: #4a5568;
  font-weight: 500;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  border-radius: 30px;
}

.navigate a:hover {
  color: #2b6cb0;
  background: rgba(66, 153, 225, 0.1);
}

.navigate a.router-link-exact-active {
  color: white;
  background: #4299e1;
  box-shadow: 0 4px 6px rgba(66, 153, 225, 0.2);
}

.navigate a.router-link-exact-active:hover {
  background: #3182ce;
}

/* 内容区域样式 */
.content {
  flex: 1;
  background: white;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4a5568;
  font-size: 1.2rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .app {
    padding: 1.5rem;
  }

  .title {
    font-size: 2rem;
  }

  .navigate {
    flex-direction: column;
    border-radius: 12px;
    padding: 0;
  }

  .navigate a {
    margin: 0.25rem;
    border-radius: 0;
    text-align: center;
  }

  .content {
    padding: 1.5rem;
  }
}

/* 动画效果 */
.navigate a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: #4299e1;
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.navigate a:hover::after {
  width: calc(100% - 3rem);
}

.navigate a.router-link-exact-active::after {
  display: none;
}
</style>
